package com.midea.thread;

import java.util.*;

public class TestThreadSafe {
    public static void main(String[] args) {
        //把线程不安全的转为线程安全的,为所有方法加上synchronized关键字
        Set<String> s1 = new HashSet<String>();
        Set<String> s2 = Collections.synchronizedSet(s1);
        List<String> l1 = new ArrayList<String>();
        List<String> l2 = Collections.synchronizedList(l1);
    }
}
